package util.essential.io;

public class Output {
	// Constants:
	private final boolean DEFAULT_VALUE = true;

	// Attributes:
	private static Output instance = null;

	private boolean normal_messages;// Allows to perform console messages.

	private boolean debug_messages;// Allows to perform debug console messages.

	private boolean error_messages;// Allows to perform error console messages.

	// Constructors: With Singleton pattern.
	private Output() {
		this.normal_messages = this.DEFAULT_VALUE;
		this.debug_messages = this.DEFAULT_VALUE;
		this.error_messages = this.DEFAULT_VALUE;
	}

	public static Output getInstance() {
		if (instance == null) {
			instance = new Output();
		}
		return instance;
	}

	// Methods:
	/**
	 * All of these out-messengers are just for debug work.
	 */
	public void simplyMessage(String txt) {
		if (Output.getInstance().normal_messages)
			System.out.print(txt);
	}

	public void message(String txt) {
		if (Output.getInstance().normal_messages)
			System.out.println(txt);
	}

	public void message(String promt, String txt) {
		if (Output.getInstance().normal_messages)
			System.out.println(promt + txt);
	}

	public void simplyDebug(String txt) {
		if (Output.getInstance().debug_messages)
			System.out.print(txt);
	}

	public void debug(String txt) {
		if (Output.getInstance().debug_messages)
			System.out.println(txt);
	}

	public void debug(String promt, String txt) {
		if (Output.getInstance().debug_messages)
			System.out.println(promt + txt);
	}

	public void errorMsg(String txt) {
		if (Output.getInstance().error_messages)
			System.err.println(txt);
	}

	public void errorMsg(String promt, String txt) {
		if (Output.getInstance().error_messages)
			System.err.println(promt + txt);
	}

	public boolean isNormal_messages() {
		return normal_messages;
	}

	public void setNormal_messages(boolean normal_messages) {
		this.normal_messages = normal_messages;
	}

	public boolean isDebug_messages() {
		return debug_messages;
	}

	public void setDebug_messages(boolean debug_messages) {
		this.debug_messages = debug_messages;
	}

	public boolean isError_messages() {
		return error_messages;
	}

	public void setError_messages(boolean error_messages) {
		this.error_messages = error_messages;
	}

}
